<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<html>
<head>
    <link rel="stylesheet" href="plug/css/css.css">
</head>
<script src="plug/js/jquery-1.9.1.min.js"></script>
<script src="plug/js/jquery.validate.min.js"></script>
<script src="plug/js/messages_zh.js"></script>
<script src="plug/js/countdown.js"></script>
<script src="plug/js/echarts.min.js"></script>
<script>

    $(function () {
var xarry = new Array();
var yarry = new Array();
$.ajax({
    async:false,
    url:"Echartslist",
    success:function (list) {
        for (let i = 0; i < list.length; i++) {
            xarry.push(list[i].rname)
            yarry.push(list[i].snum)
        }
    }
})
        var chartDom = document.getElementById('main');
        var myChart = echarts.init(chartDom);
        var option;

        option = {
            xAxis: {
                type: 'category',
                data: xarry
            },
            yAxis: {
                type: 'value'
            },
            series: [
                {
                    data: yarry,
                    type: 'bar',
                    showBackground: true,
                    backgroundStyle: {
                        color: 'rgba(180, 180, 180, 0.2)'
                    }
                }
            ]
        };

        option && myChart.setOption(option);

    })
</script>
<body>
<div id="main" style="height: 400px; width: 100%;"></div>

<script>
</script>
</body>
</html>